<!-- src/page/home/App.vue -->
<template>
  <main>
    <h1>出错力(悲)</h1>
    <button @click="returnHome">返回主页</button>
    <h1>出错了!让牢大把错误肘飞!!!</h1>
    <img :src="`${url}img/error.jpeg`" width="514xp" alt="提示加载中">
    <h1>man!what can I say!manba out</h1>
    <p>错误信息如下：</p>
    <ul>
      <li>错误信息:{{ errorMxg }}</li>
      <li>错误事件描述:{{ errorEvent }}</li>
    </ul>
  </main>
</template>

<script lang="ts" setup>
import '@assets/css/style.css'
import {ref} from 'vue'
import {globalConst} from '@constants/globalConst.ts'

const errorMxg = ref('')
const errorEvent = ref('')
const url = globalConst.staticResourceUrl
if (localStorage.getItem('global_error')) {
  let error = null;
  try {
    error = JSON.parse(<string>localStorage.getItem('global_error'))
  } catch (e) {
    error = null
  }
  errorMxg.value = error ? error.msg : '未知错误'
  errorEvent.value = error ? error.detail : localStorage.getItem('global_error')
  // 清除错误信息
  localStorage.removeItem('global_error')
}

function returnHome() {
  location.href = '/src/page/home/index.html'
}
</script>

<style scoped>
</style>
